package file.day9_16;

import java.io.File;
import java.io.FileFilter;

public class LambdaDemo筛选器缩写 {
    public static void main(String[] args) {
        FileFilter filter = new FileFilter() {
            public boolean accept(File file) {
                return file.getName().contains("o");
            }
        };

        FileFilter filter1 = (File file)->{
            return file.getName().contains("o");
        };

        FileFilter filter2 = (file)->{
            return file.getName().contains("o");
        };

        FileFilter filter3 = (file)->file.getName().contains("o");

        FileFilter filter4 = file->file.getName().contains("o");

        File dir = new File("C:/Program Files");
        if(dir.isDirectory()){
            File[] subs = dir.listFiles(filter1);
            for(File file : subs){
                System.out.println(file.getName());
            }
        }else {
            System.out.println("不存在");
        }
    }
}
